#include <iostream>
#include <ctime>

#define INFO    0
#define DEBUG   1
#define ERROR   2
#define FATAL   3

#define LOG_LEVEL INFO

#define LOG(level_str, level, format, ...) do{\
    if (level < LOG_LEVEL) break;\
    time_t t = time(nullptr);\
    struct tm* ptm = localtime(&t);\
    char time_str[32]{};\
    strftime(time_str, 31, "%H:%M:%S", ptm);\
    printf("[%s] [%s] [%s:%d] " format "\n", level_str, time_str, __FILE__, __LINE__, ##__VA_ARGS__);\
} while(0)

#define INFO_LOG(format, ...) LOG("INFO", INFO, format, ##__VA_ARGS__)
#define DEBUG_LOG(format, ...) LOG("DEBUG", DEBUG, format, ##__VA_ARGS__)
#define ERROR_LOG(format, ...) LOG("ERROR", ERROR, format, ##__VA_ARGS__)
#define FATAL_LOG(format, ...) LOG("FATAL", FATAL, format, ##__VA_ARGS__)

int main()
{
    INFO_LOG("Nihao");

    return 0;
}